public class Demo2 {
    public static void main(String args[]) {
        SuperClass superObj = new SuperClass();
        SonClass sonObj = new SonClass();
        // 下面的代码运行时会抛出异常，不能将父类对象直接转换为子类类型
        //SonClass sonObj2 = (SonClass)superObj;
        // 先向上转型，再向下转型
        superObj = sonObj;
        SonClass sonObj1 = (SonClass)superObj;
    }
}
class SuperClass{ }
class SonClass extends SuperClass{ } 
